package com.travel.haoma.activity;

import android.os.Bundle;
import android.view.View;
import android.widget.GridView;

import com.travel.haoma.R;

import java.util.ArrayList;
import java.util.List;

import cn.haoma.base.common.BaseFragment;
import cn.haoma.base.common.CommonAdapter;
import cn.haoma.base.common.Id;
import cn.haoma.base.common.LayoutId;
import cn.haoma.base.common.ViewHolder;

/**
 * Created by admin on 2015/9/2.
 */
@LayoutId(R.layout.frg_time_img)
public class FrgTimeImg extends BaseFragment {
    @Id(R.id.bt_switch)
    private View btSwitch;
    @Id(R.id.bt_categary_content)
    private View categaryContent;
    @Id(R.id.gradview)
    private GridView gridView;
    private CommonAdapter adapter;
    private List list = new ArrayList();

    @Override
    public void onViewCreated(View view, Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        init();
    }

    @Override
    public void onClick(View view) {
        super.onClick(view);
        switch (view.getId()){
            case R.id.bt_switch:
                if(categaryContent.isShown())
                    categaryContent.setVisibility(View.GONE);
                else categaryContent.setVisibility(View.VISIBLE);
                break;
            case R.id.bt_add:
                startActivity(ActTimePieces.newIntent(getActivity()));
                break;
        }
    }
    private void init(){
        list.add(1);
        list.add(1);
        list.add(1);
        list.add(1);
        list.add(1);
        list.add(1);
        list.add(1);

        adapter = new CommonAdapter(getActivity(),list,R.layout.item_show_img) {
            @Override
            public void convert(ViewHolder helper, Object item) {

            }
        };
        gridView.setAdapter(adapter);
    }
}
